﻿<%@ Page Title="Home Page" Language="vb" MasterPageFile="~/Site.Master" AutoEventWireup="false"
    CodeBehind="Default.aspx.vb" Inherits="customtech._Default" %>

<asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent">
</asp:Content>
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
    
    <h1 class="listhead">
    LIST OF BUILDS</h1>
    <br />
    
    <div class="buildList">
        
        <asp:ListView ID="ListView1" runat="server">
            <AlternatingItemTemplate>
               <span style="">
                <hr />
                <a href='details.aspx?ID=<%# Eval("ID") %>'><img alt="Build Picture" width = "120" height = "120" src='<%# Eval("BuildPicture")%>'/></a>
             
                <a href='details.aspx?ID=<%# Eval("ID") %>'><asp:Label ID="BuildNameLabel" runat="server" Text='<%# Eval("BuildName") %>' /></a>
                <br />
               
                Added by
                <a href='userProfile.aspx?UserName=<%# Eval("UserName") %>'><asp:Label ID="Label2" runat="server" Text='<%# Eval("UserName") %>' /></a>
                On
                <asp:Label ID="DateAddedLabel" runat="server" Text='<%# Eval("DateAdded") %>' />
                <br />
                Rating:
                <asp:Label ID="AverageRatingLabel" runat="server" 
                    Text='<%# Eval("AverageRating") %>' />
                <br />
                Likes:
                <asp:Label ID="CountOfIDLabel" runat="server" Text='<%# Eval("CountOfID") %>' />
                <br />
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Description") %>' />
                <br />
                <hr />
                <br />
<br /></span>
            </AlternatingItemTemplate>
            <EditItemTemplate>
                <span style="">ID:
                <asp:Label ID="IDLabel1" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                BuildName:
                <asp:TextBox ID="BuildNameTextBox" runat="server" 
                    Text='<%# Bind("BuildName") %>' />
                <br />
                BuildPicture:
                <asp:TextBox ID="BuildPictureTextBox" runat="server" 
                    Text='<%# Bind("BuildPicture") %>' />
                <br />
                TotalCostToBuild:
                <asp:TextBox ID="TotalCostToBuildTextBox" runat="server" 
                    Text='<%# Bind("TotalCostToBuild") %>' />
                <br />
                UserName:
                <asp:TextBox ID="UserNameTextBox" runat="server" 
                    Text='<%# Bind("UserName") %>' />
                <br />
                DateAdded:
                <asp:TextBox ID="DateAddedTextBox" runat="server" 
                    Text='<%# Bind("DateAdded") %>' />
                <br />
                AverageRating:
                <asp:TextBox ID="AverageRatingTextBox" runat="server" 
                    Text='<%# Bind("AverageRating") %>' />
                <br />
                CountOfID:
                <asp:TextBox ID="CountOfIDTextBox" runat="server" 
                    Text='<%# Bind("CountOfID") %>' />
                <br />
                <asp:Button ID="UpdateButton" runat="server" CommandName="Update" 
                    Text="Update" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Cancel" />
                <br /><br /></span>
            </EditItemTemplate>
            <EmptyDataTemplate>
                <span>No data was returned.</span>
            </EmptyDataTemplate>
            <InsertItemTemplate>
                <span style="">BuildName:
                <asp:TextBox ID="BuildNameTextBox" runat="server" 
                    Text='<%# Bind("BuildName") %>' />
                <br />BuildPicture:
                <asp:TextBox ID="BuildPictureTextBox" runat="server" 
                    Text='<%# Bind("BuildPicture") %>' />
                <br />TotalCostToBuild:
                <asp:TextBox ID="TotalCostToBuildTextBox" runat="server" 
                    Text='<%# Bind("TotalCostToBuild") %>' />
                <br />UserName:
                <asp:TextBox ID="UserNameTextBox" runat="server" 
                    Text='<%# Bind("UserName") %>' />
                <br />DateAdded:
                <asp:TextBox ID="DateAddedTextBox" runat="server" 
                    Text='<%# Bind("DateAdded") %>' />
                <br />AverageRating:
                <asp:TextBox ID="AverageRatingTextBox" runat="server" 
                    Text='<%# Bind("AverageRating") %>' />
                <br />CountOfID:
                <asp:TextBox ID="CountOfIDTextBox" runat="server" 
                    Text='<%# Bind("CountOfID") %>' />
                <br />
                <asp:Button ID="InsertButton" runat="server" CommandName="Insert" 
                    Text="Insert" />
                <asp:Button ID="CancelButton" runat="server" CommandName="Cancel" 
                    Text="Clear" />
                <br /><br /></span>
            </InsertItemTemplate>
            <ItemTemplate>
                <span style="">
                <hr />
                <a href='details.aspx?ID=<%# Eval("ID") %>'><img alt="Build Picture" width = "120" height = "120" src='<%# Eval("BuildPicture")%>'/></a>
             
                <a href='details.aspx?ID=<%# Eval("ID") %>'><asp:Label ID="BuildNameLabel" runat="server" Text='<%# Eval("BuildName") %>' /></a>
                <br />
               
                Added by
                <a href='userProfile.aspx?UserName=<%# Eval("UserName") %>'><asp:Label ID="Label2" runat="server" Text='<%# Eval("UserName") %>' /></a>
                On
                <asp:Label ID="DateAddedLabel" runat="server" Text='<%# Eval("DateAdded") %>' />
                <br />
                Rating:
                <asp:Label ID="AverageRatingLabel" runat="server" 
                    Text='<%# Eval("AverageRating") %>' />
                <br />
                Likes:
                <asp:Label ID="CountOfIDLabel" runat="server" Text='<%# Eval("CountOfID") %>' />
                <br />
                <asp:Label ID="Label1" runat="server" Text='<%# Eval("Description") %>' />
                <br />
                <hr />
                <br />
<br /></span>
            </ItemTemplate>
            <LayoutTemplate>
                <div ID="itemPlaceholderContainer" runat="server" style="">
                    <span runat="server" id="itemPlaceholder" />
                </div>
                <div style="">
                    <asp:DataPager ID="DataPager1" runat="server">
                        <Fields>
                            <asp:NextPreviousPagerField ButtonType="Button" ShowFirstPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                            <asp:NumericPagerField />
                            <asp:NextPreviousPagerField ButtonType="Button" ShowLastPageButton="True" 
                                ShowNextPageButton="False" ShowPreviousPageButton="False" />
                        </Fields>
                    </asp:DataPager>
                </div>
            </LayoutTemplate>
            <SelectedItemTemplate>
                <span style="">ID:
                <asp:Label ID="IDLabel" runat="server" Text='<%# Eval("ID") %>' />
                <br />
                BuildName:
                <asp:Label ID="BuildNameLabel" runat="server" Text='<%# Eval("BuildName") %>' />
                <br />
                BuildPicture:
                <asp:Label ID="BuildPictureLabel" runat="server" 
                    Text='<%# Eval("BuildPicture") %>' />
                <br />
                TotalCostToBuild:
                <asp:Label ID="TotalCostToBuildLabel" runat="server" 
                    Text='<%# Eval("TotalCostToBuild") %>' />
                <br />
                UserName:
                <asp:Label ID="UserNameLabel" runat="server" Text='<%# Eval("UserName") %>' />
                <br />
                DateAdded:
                <asp:Label ID="DateAddedLabel" runat="server" Text='<%# Eval("DateAdded") %>' />
                <br />
                AverageRating:
                <asp:Label ID="AverageRatingLabel" runat="server" 
                    Text='<%# Eval("AverageRating") %>' />
                <br />
                CountOfID:
                <asp:Label ID="CountOfIDLabel" runat="server" Text='<%# Eval("CountOfID") %>' />
                <br />
<br /></span>
            </SelectedItemTemplate>
        </asp:ListView>
    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:connstr %>" 
        ProviderName="<%$ ConnectionStrings:connstr.ProviderName %>" 
        
            
            
            SelectCommand="SELECT [BuildName], [BuildPicture], [TotalCostToBuild], [UserName], [AverageRating], [DateAdded], [CountOfID], [ID], [Description] FROM [Builds Query1]">
    </asp:SqlDataSource>
        
        <br />
    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:connstr %>" 
        ProviderName="<%$ ConnectionStrings:connstr.ProviderName %>" 
        
            
            
            SelectCommand="SELECT DISTINCT [ID], [BuildName], [AverageRating], [CountOfID], [TagName], [UserName], [DateAdded], [BuildPicture], [TotalCostToBuild], [Description] FROM [Builds Query2] WHERE ([TagName] = ?)">
        <SelectParameters>
            <asp:QueryStringParameter Name="TagName" QueryStringField="TagName" 
                Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>
        
    </div>
    <div class="tagList">
        <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource2">
        <HeaderTemplate>
                <p> <h3>Tags</h3> </p>
        </HeaderTemplate>
        <ItemTemplate>
        <a href="Default.aspx?Tagname=<%#Eval("TagName")%>">
       <%#Eval("TagName")%>
       </a>
       
                <hr />
                
        </ItemTemplate>
        <FooterTemplate>
                <a href="Default.aspx">Reset</a>
        </FooterTemplate>
        </asp:Repeater>
        <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:connstr %>" 
            ProviderName="<%$ ConnectionStrings:connstr.ProviderName %>" 
            SelectCommand="SELECT [ID], [TagName] FROM [Tags]"></asp:SqlDataSource>
            <hr />
            &nbsp;<asp:Button ID="Button1" runat="server" PostBackUrl="~/addBuild.aspx" 
            Text="Add Build" />
        <br />
        <br />
        <br />
        <asp:TextBox ID="tb_tsearch" runat="server" Width="200px"></asp:TextBox>
        <asp:Button ID="btn_tsearch" runat="server" Text="Tag Search" Width="88px" />
        <br />
        <br />
        <p>
            No. of builds: <asp:Label ID="lbl_builds" runat="server" Text="Label"></asp:Label>
        </p>
        <br />
        <p>
        No. of users: <asp:Label ID="lbl_users" runat="server" Text="Label"></asp:Label>
        </p>
        <br />
        <asp:Image ID="Image1" runat="server" Height="50px" ImageAlign="Top" 
            ImageUrl="~/Pictures/english_flag.png" Width="100px" />
        </div>


    <p> &nbsp;</p>
    <p> 

        &nbsp;</p>
</asp:Content>
